package com.lzy.cloud.order.service.impl;

import com.lzy.cloud.order.dtos.OrderRefundLogDto;
import com.lzy.cloud.order.dtos.pay.OrderPayParamsDto;
import com.lzy.cloud.order.entity.OrderRefundLog;
import com.lzy.cloud.order.entity.OrderRule;
import com.lzy.cloud.order.mapper.OrderRefundLogMapperExt;
import com.lzy.cloud.order.service.OrderRefundLogService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 订单退款记录
 * @Author:   gyl
 * @Date:     2018/7/10 17:11
 */
@Service
public class OrderRefundLogServiceImpl implements OrderRefundLogService {

    @Autowired
    private OrderRefundLogMapperExt orderRefundLogMapperExt;

    @Override
    public List<OrderRefundLogDto> queryListByOrderId(OrderPayParamsDto orderPayParamsDto) {
        return orderRefundLogMapperExt.queryListByOrderId(orderPayParamsDto);
    }

    @Override
    public Long create(OrderRefundLogDto orderRefundLogDto) {
        OrderRefundLog orderRefundLog = DozerUtils.map(orderRefundLogDto, OrderRefundLog.class);
        return orderRefundLogMapperExt.insertSelective(orderRefundLog)>0 ? orderRefundLog.getId() : 0;
    }

    @Override
    public Boolean updateByOrderId(OrderPayParamsDto orderPayParamsDto) {
        return orderRefundLogMapperExt.updateByOrderId(orderPayParamsDto) > 0;
    }
}
